package cn.lianyutiantang.mybasecloud.controller;

import cn.lianyutiantang.mybasecloud.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhengjl
 * @ClassName UserController
 * @Description TODO
 * @Date 2018/11/821:01
 * @Version 1.0
 **/
@RestController
public class UserController {
    @Autowired
    UserService userService;

    @RequestMapping(value = "getUserObject",method = RequestMethod.GET)
    public Object getUser (String userId){
        Map baseResponse=new HashMap();
         if(StringUtils.isEmpty(userId)){
             baseResponse.put("code","500");
             baseResponse.put("msg","error");
             return baseResponse;
          }
        Map<String, Object> userObject = userService.getUserObject(userId);
        return userObject;
    }
}
